package com.cloud.cloudshop.config.redisson;

import org.redisson.api.RLock;
import org.redisson.api.RedissonClient;

import java.util.concurrent.TimeUnit;

public interface DistributedLock {

    RLock lock(String lockKey);

    RLock lock(String lockKey, int timeout);

    RLock lock(String lockKey, TimeUnit unit, int timeout);

    boolean tryLock(String lockKey, TimeUnit unit, int waitTime, int leaseTime);

    void unlock(String lockKey);

    void unlock(RLock lock);

    void setRedissonClient(RedissonClient redissonClient);

    RLock readLock(String lockKey);

    RLock readLock(String lockKey, int leaseTime);

    RLock writeLock(String lockKey);

    RLock writeLock(String lockKey, int leaseTime);
}
